<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="${staticServer}/inc/style/main.css"/>
    <link rel="stylesheet" href="${staticServer}/inc/style/page.css"/>
    <link rel="stylesheet" href="${staticServer}/css/work_today.css"/>
    <link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css"/>
    <script src="${staticServer}/inc/js/jquery.js"></script>
    <script src="${staticServer}/inc/js/pageset.js"></script>
    <script src="${staticServer}/inc/js/submitter.js"></script>
    <script src="${staticServer}/inc/js/infopad.js?2.2"></script>
    <script src="${staticServer}/inc/js/tips.js"></script>
    <script src="${staticServer}/js/web/consultant_client_tracking_list.js?1.0"></script>

    <link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css"/>
    <script src="${staticServer}/inc/js/datepicker.js"></script>

    <script>
        var contextPath = '${contextPath}';
        var _contextPath = '${staticServer}';
       
        var path='http://120.55.241.58/';
        $(function () {
            $("#center").val("<#if zhichu??>${zhichu.regionns}</#if>")
        });

        var delMoney = function () {
            var $obj = $("#datas td input[type=checkbox]:checked");
            if ($obj.length == 0) {
                infopad.err("请至少选择一条记录");
                return;
            }
            if (confirm("确定删除？删除后无法恢复。")) {
                var ids = '';
                for (var i = 0; i < $obj.length; i++) {
                    if (i == $obj.length - 1) {
                        ids += $($obj[i]).val();
                    } else {
                        ids += $($obj[i]).val() + ",";
                    }
                }
                var url = contextPath + "/index/deleteMoney.json";
                $.post(url, {"ids": ids},
                        function (ms) {
                            if (ms.msg != null) {
                                if (ms.msg == "1") {
                                    infopad.msg("删除成功!");
                                    setTimeout(function () {
                                        location.reload();
                                    }, 1200);
                                } else if (ms.msg == "2") {
                                    infopad.err("不是自己填写的，不可删除!");
                                } else if (ms.msg == "3") {
                                    infopad.err("已审核通过，不可删除!");
                                } else {
                                    infopad.err("抱歉，系统忙");
                                }

                            } else {
                                infopad.err("抱歉，系统忙");
                            }
                        });
            };
        }

        function getXiaZai() {
            var center = $("#center").val();
            var state = $("#name1").val();
            var stu_name = $("#stu_name").val();
            var pra_type = $("#pra_type").val();
            var nickname1 = $("#nickname1").val();
            var startTime = $("#startTime").val();
            var endTime = $("#endTime").val();
            if (startTime == "") {
                infopad.err("开始时间不能为空");
                return;
            }else{
            	infopad.err("正在下载，请稍等!");
            }
            $.post('${contextPath}/index/moneyListXz.json', {
                center: center,
                state: state,
                stu_name: stu_name,
                nickname1: nickname1,
                pra_type: pra_type,
                startTime: startTime,
                endTime: endTime
            }, function (data) {
                if (data) {
                    if (data.name != null) {
                        window.location.href = "http://120.55.241.58//mydata/uploadtea/xls/" + data.name;
                    }
                }
            });
        }

          function getx(id){
        
        	 
        	$.post(contextPath+"/index/getpack.json", {
        		"id" : id,
        		
        	}, function(ms) {
        		if(ms){
        			window.location.href = path+ms.name;
        		}
        	});
        }
        function submit() {
            window.location.href = "${contextPath}/index/moneyList.htm?center=" + $("#center").val() + "&stu_name=" + $("#stu_name").val() + "&state=" + $("#state").val() + "&nickname1=" + $("#nickname1").val() + "&startTime=" + $("#startTime").val() + "&endTime=" + $("#endTime").val()+ "&pra_type=" + $("#pra_type").val();
        }


        function uploadWeekToExcel() {
            var  status=  $("#downloadType").val();
            if (status==1 ){
                location.href = "${contextPath}/index/uploadWeekToExcel.htm?startTime=" + $("#startTime").val() + "&endTime=" + $("#endTime").val();
            }else if (status==2){
                $.post('${contextPath}/index/enrollmentSingular.json',{
                    startTime:$("#startTime").val(),
                    endTime:$("#endTime").val()
                },function(data){
                    if(data){
                        if(data.name!=null){
                            window.location.href = "http://120.55.241.58//mydata/uploadtea/xls/" + data.name;
                        }
                    }
                });
            }else if (status==3){
                $.post('${contextPath}/index/flowInformation.json',{
                    startTime:$("#startTime").val(),
                    endTime:$("#endTime").val()
                },function(data){

                    if(data){
                        if(data.name!=null){
                            window.location.href = "http://120.55.241.58//mydata/uploadtea/xls/" + data.name;
                        }
                    }
                });

            }


        }
        
        
       
       var tsdelMoney = function (id) {
                var url = contextPath + "/index/tsdeleteMoney.json";
                $.post(url, {"id": id},
                        function (ms) {
                            if (ms.msg != null) {
                                if (ms.msg == "1") {
                                    infopad.msg("删除成功!");
                                    setTimeout(function () {
                                        location.reload();
                                    }, 1200);
                                } else if (ms.msg == "2") {
                                    infopad.err("不是自己填写的，不可删除!");
                                } else {
                                    infopad.err("抱歉，系统忙");
                                }

                            } else {
                                infopad.err("抱歉，系统忙");
                            }
                        });
            };
        
    </script>

    <script>

        function isSuccessOrder(flag) {
            var $obj = $("#datas td input[type=checkbox]:checked");
            if ($obj.length == 0) {
                infopad.err("请至少选择一条记录");
                return false;
            }
            var ids = '';
            for (var i = 0; i < $obj.length; i++) {
                if (i == $obj.length - 1) {
                    ids += $($obj[i]).val();
                } else {
                    ids += $($obj[i]).val() + ",";
                }
            }
            $.ajax({
                type: 'POST',
                url: 'isSuccessOrder.htm',
                data: {"ids": ids, "flag": flag},
                dataType: "text",
                success: function (data) {
                    if (data=="success"){
                        infopad.err("标记成功!");
                        window.location.reload();
                    }else {
                        infopad.err("标记失败，服务器错误！");
                    }
                },
                error: function () {
                    infopad.err("系统出现问题");
                }
            });
        }

    </script>

</head>

<body>
<input type="hidden" id="traId" value="">
<div id="home_link">
    <ul>
        <li>财务管理</li>
        <li>&gt;</li>
        <li class="current">学员缴费列表</li>
    </ul>
</div>
<div id="container">
    <div id="title">学员缴费列表</div>
    <table class="simple_table" rel="nohover" style="min-width: 750px;">
        <tr>

            <td>
            <#if webutil.getCookieUser().username=="system" ||webutil.getCookieUser().username=="yuanjing">
                <label for="phone">中心地址：</label>
            <select id="center">
                <option value="">全部</option>
                <#if offList??>
                    <#list offList as list>
                        <option value="${list.keyname}">${list.name}</option>
                    </#list>
                </#if>
            <select>
            </#if>

                <label for="phone">审核状态：</label>
                <select id="state">
                    <option value="">全部</option>
                    <option value="0">未审核</option>
                    <option value="1">未通过</option>
                    <option value="2">已审核</option>
                </select>

                <label for="phone">学生姓名：</label>
                <input type="text" value="" id="stu_name"/>

                <label for="phone">老师姓名：</label>
                <input type="text" value="" id="nickname1"/>
                
                

                <br/>
                <label for="phone">开始时间：</label>
                <input type="text" id="startTime" rel="DATE::Y-m-d" value="${startTime}" size="15" maxlength="15"
                       readonly="readonly" class="DatePicker_Icon">
                <label for="phone">结束时间：</label>
                <input type="text" id="endTime" rel="DATE::Y-m-d" value="${endTime}" size="15" maxlength="15"
                       readonly="readonly" class="DatePicker_Icon">
                       
                <label for="phone">课程类型：</label>
                <select id="pra_type">
                    <option value="">全部</option>
                    <option value="1">非脑电</option>
                    <option value="2">普通中心</option>
                    <option value="3">全脑</option>
                    <option value="4">太优</option>
                    <option value="5">家庭训练</option>
                    <option value="6">夏令营</option>
                    <option value="7">上门费</option>
                    <option value="8">暑期培优班（非在读）</option>
                    <option value="9">暑期培优班（在读）</option>
                    <option value="10">寒假培优班</option>
                </select>
            </td>


            <td rowspan="4">
                <input type="button" value=" 查 询 " onclick="submit()"/>
            <#if webutil.getCookieUser().username=="system" || webutil.getCookieUser().username=="zhangchumin" || webutil.getCookieUser().username=="wangjiawei" || webutil.getCookieUser().username=="yuanjing">
                <input type="button" value=" 下 载 " onclick="getXiaZai()"/>
            </#if>
                <input type="button" value=" 删 除 " onclick="delMoney()"/>
                </br>
                
   				<#if webutil.getCookieUser().username=="system"  || webutil.getCookieUser().username=="wangjiawei" || webutil.getCookieUser().username=="he">
    			<input type="button" value=" 标记成单 " onclick="isSuccessOrder(1)"/>
                <input type="button" value=" 取消成单 " onclick="isSuccessOrder(2)"/>
				</#if>
			</td>

            <#if webutil.getCookieUser().username=="system" || webutil.getCookieUser().username=="zhangchumin" || webutil.getCookieUser().username=="wangjiawei" || webutil.getCookieUser().username=="yuanjing">
            <td rowspan="2">
                <select id="downloadType">
                    <option value="1">各类款项个数及金额统计下载</option>
                    <option value="2">未成单数下载</option>
                    <option value="3">流水信息下载</option>

                </select>
                <input type="button" value="下载" onclick="uploadWeekToExcel()"/>
            </td>
			</#if>

        </tr>
    </table>
    <table>
        <tr class="fields">
            <th width="3%"></th>
            <th width="70">学员姓名</th>
            <th width="70">联系电话</th>
            <th width="100">交款中心</th>
            <th width="70">接待老师</th>
            <th width="100">课程类型</th>
            <th width="40">课程数</th>
            <th width="70">缴费类型</th>
            <th width="80">交款方式</th>
            <th width="70">交款金额</th>
            <th width="100">凭证</th>
            <th width="100">交款时间</th>
            <th width="50">状态</th>
            <th width="140">操作</th>
             <th width="50">下载文件</th>
        </tr>

    <#if list??>
        <#list list as list>
        <tbody id="datas">
        <#if list.isSuccess==1>
        <tr class="even_row" style="color:#31b0d5">
        <#else >
        <tr class="even_row" >
        </#if>

            <td align="center"><input name="" style="width:16px;height:16px;"  type="checkbox" value="${list.id}"></td>
            <td align="center"><#if list.stu_id?? && list.stu_id!=0>${list.stu_name}<#else>${list.student}</#if></td>
            <td align="center">
                <#if list.phlist??>
                    <#list list.phlist as phlist>
                        <a title="<#if phlist.phone!="">${phlist.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> "
                           id="${list.id}">
                            <#assign phone1 = "${phlist.phone}">
                            <#if phlist.name=="爸爸" || phlist.name=="妈妈">
                                <em class="caption"></em>${phlist.phone}</br>
                                <em class="caption"></em>${phlist.name}</br>
                            <#elseif phlist.guanxi!="">
                                <em class="caption"></em>${phlist.phone}</br>
                                <em class="caption"></em>${phlist.guanxi}</br>
                            <#else>
                                <em class="caption"></em>${phlist.phone}</br>
                                <em class="caption"></em>${phlist.name}</br>
                            </#if>
                        </a>
                    </#list>
                <#else>
                    <a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> "
                       id="${list.id}">
                        <#if list.phone!="" && list.phone?contains('[]')==false>
                            <em class="caption"></em>${list.phone}
                        <#elseif list.qq!="">
                            <em class="caption">QQ:</em>${list.qq}
                        <#elseif list.email!="">
                            <em class="caption">email:</em>${list.email}
                        </#if>
                    </a>
                </#if>
            </td>
            <td align="center">${list.center}</td>

            <td align="center">${list.nickname1}<br/>${list.nickname2}<br/>${list.record_teacher}</td>
            <td align="center">
                <#if list.pra_type=="1">
                    非脑电
                <#elseif list.pra_type=="2">
                    普通中心
                <#elseif list.pra_type=="3">
                    全脑
                <#elseif list.pra_type=="4">
                    太优
                <#elseif list.pra_type=="5">
                    家庭训练
                <#elseif list.pra_type=="6">
                    夏令营
                <#elseif list.pra_type=="7">
                    上门费
                <#elseif list.pra_type=="8">
                    暑期培优班（非在读）            
                <#elseif list.pra_type=="9">
        暑期培优班（在读）
                <#elseif list.pra_type=="10">
                    寒假培优班
                </#if>
                <#if list.pra_type!="6"&&list.pra_type!="7">
                ${list.times}<#if list.pra_type=="5">月<#else>次</#if>
                </#if>
                <#if list.pra_type=="7">
                ${list.smf_c}次
                </#if>
            </td>
            <td align="center">
            <#if list.moneyType1==1>
                <#if list.moneyType2!="1">
                    <#if list.pra_type+list.times==31>
                        0.25
                    <#elseif list.pra_type+list.times==61>
                        0.5
                    <#elseif list.pra_type+list.times==32>
                        0.5
                    <#elseif list.pra_type+list.times==62>
                        1
                    <#elseif list.pra_type+list.times==92>
                        1.5
                    <#elseif list.pra_type+list.times==122>
                        2
                    <#elseif list.pra_type+list.times==33>
                        0.67
                    <#elseif list.pra_type+list.times==48>
                        1
                    <#elseif list.pra_type+list.times==63>
                        1.33
                    <#elseif list.pra_type+list.times==93>
                        2
                    </#if>
                </#if>
            </#if>
            </td>
            <td align="center">
                <#if list.moneyType1=="1">
                    新增
                <#elseif list.moneyType1=="2">
                    续费
                </#if>
                <#if list.moneyType2=="1">
                    定金
                <#elseif list.moneyType2=="2">
                    部分款
                <#elseif list.moneyType2=="3">
                    全款
                <#elseif list.moneyType2=="4">
                    尾款
                </#if>
            </td>
            <td align="center">
                <#if webutil.getCookieUser().username=="system">
							<#if list.bank_id?? && list.bank_id!="">${list.bank_id}<#else>${list.met_name}</#if>
						<#else>
                ${list.met_name}
                </#if>
            </td>
            <td align="center">
                <#if list.met_name?? && list.met_name!="">
                    <#if list.met_name=="POS刷卡" || list.met_name=="POS刷卡（备用）" ||list.met_name?contains("POS刷卡（备用")>
                                <#if list.moneys??>
                                    <#if list.moneys gt 4487 >
                                        <#if list.center??>
                                            <#if list.center=="杭州景芳中心" || list.center=="南京雨花台中心" || list.center=="北京上地中心" || list.center=="天津小白楼中心" || list.center=="重庆南坪中心">
                                            ${list.moneys-30}
                                            <#else>
                                            ${list.moneys-35}
                                            </#if>
                                        <#else>
                                        ${list.moneys-35}
                                        </#if>
                                    <#else>
                                    ${list.moneys-list.moneys*0.0078}
                            </#if>
                        </#if>
                    <#else>
                    ${list.moneys}
                    </#if>
                </#if>

                <br/>(${list.moneys})
            </td>
            <td align="center">
                <ul class="imglist">
                    <div id="images" style="float: left;">
                        <#if list.pz_url?? && list.pz_url!="">
                            <#list list.pz_url?split(",") as imgurl>
                                <#if imgurl_index ==1>
                                   图片已上传
                                </#if>
                            </#list>
                        </#if>
                    </div>
                </ul>
            </td>
            <td align="center"><#if list.moneyDate??>${list.moneyDate?date}</#if></td>
            <td align="center">
            	<#if list.state=="0">未审核
            	<#elseif list.state=="1">未通过
            	<#elseif list.state=="2">已通过</#if>
            </td>
            <td align="center">
                <#if webutil.getCookieUser().username=="system" || webutil.getCookieUser().username=="zhangxiaoqian">
                    <a href="${contextPath}/index/moenysDetail.htm?id=${list.id}">查看</a>
                <#elseif webutil.getCookieUser().username=="he">
                	<a href="${contextPath}/index/addMoenys.htm?id=${list.id}">编辑</a>&nbsp;
                	<a href="${contextPath}/index/add_PZ_picture.htm?id=${list.id}">补传凭证</a>&nbsp;	
                	<a href="" onclick="tsdelMoney(${list.id})">删除</a>
                <#else>
                    <#if webutil.getCookieUser().username=="${list.username}" || webutil.getCookieUser().username=="${list.jd_username1}" || webutil.getCookieUser().username=="${list.jd_username2}">
                        <#if list.state=="2">
                            <a href="">已成交</a>
                        <#else>
                            <a href="${contextPath}/index/addMoenys.htm?id=${list.id}">编辑</a>&nbsp;
                            <a href="${contextPath}/index/add_PZ_picture.htm?id=${list.id}">补传凭证</a>&nbsp;	
                        </#if>
                    <#else>
                        <a href="${contextPath}/index/moenysDetail.htm?id=${list.id}">查看</a>
                    </#if>
                </#if>
            
            </td>
            <td>
           
            <button onclick = getx(${list.id})>
下载
</button>
            </td>
        </tr>
        </#list>
    </#if>
    </table>
</div>

<div id="pager">
    <ul id="pagination" style="padding-left: 14px">
    <#if page??>
        <#if page.pagetotal?? && page.pagetotal!="0">
            <#assign pagetotal = page.pagetotal>
        <#else>
            <#assign pagetotal = 1>
        </#if>
        <#if page.currpage??>
            <#assign currpage = page.currpage>
        <#else>
            <#assign currpage = 1>
        </#if>
        <#if currpage==1 >
            <li class="previous-off">首页</li>
            <li class="previous-off">上一页</li>
        <#else>
            <li class="previous"><a
                    href="${contextPath}/index/moneyList.htm?currPage=1&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">首页</a>
            </li>
            <li class="previous"><a
                    href="${contextPath}/index/moneyList.htm?currPage=${currpage-1}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">上一页</a>
            </li>
        </#if>
        <input type="hidden" id="total" value="${page.pagetotal}"/>
        <#if pagetotal<=11>
            <#list 1..pagetotal as index_up>
                <#if currpage==index_up >
                    <li class="current">${index_up}</li>
                <#else>
                    <li>
                        <a href="${contextPath}/index/moneyList.htm?currPage=${index_up}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${index_up}</a>
                    </li>
                </#if>
            </#list>
        <#else>
            <#if currpage<=8 >
                <#list 1..9 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/index/moneyList.htm?currPage=${index_up}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
                <li>...</li>
                <li>
                    <a href="${contextPath}/index/moneyList.htm?currPage=${pagetotal}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${pagetotal}</a>
                </li>

            <#elseif (currpage>= 9 && currpage<pagetotal-7)  >
                <li>
                    <a href="${contextPath}/index/moneyList.htm?currPage=1&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">1</a>
                </li>
                <li>...</li>
                <#list currpage-3..currpage+3 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/index/moneyList.htm?currPage=${index_up}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
                <li>...</li>
                <li>
                    <a href="${contextPath}/index/moneyList.htm?currPage=${pagetotal}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${pagetotal}</a>
                </li>
            <#else>
                <li>
                    <a href="${contextPath}/index/moneyList.htm?currPage=1&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">1</a>
                </li>
                <li>...</li>
                <#list pagetotal-8..pagetotal as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/index/moneyList.htm?currPage=${index_up}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
            </#if>
        </#if>
        <#if currpage==pagetotal >
            <li class="previous-off">下一页</li>
            <li class="previous-off">尾页</li>
        <#else>
            <li class="previous"><a
                    href="${contextPath}/index/moneyList.htm?currPage=${currpage+1}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">下一页</a>
            </li>
            <li class="previous"><a
                    href="${contextPath}/index/moneyList.htm?currPage=${page.pagetotal}&nickname1=${money.nickname1}&center=${money.jd_center_key}&startTime=${startTime}&endTime=${endTime}&stu_name=${stu_name}&state=${state}&pra_type=${money.pra_type}">尾页</a>
            </li>
        </#if>
        <li class="previous"></li>
        <li class="pageinfo">共${page.total}条记录</li>
    </#if>
    </ul>
</div>

<div class="emptyline"></div>
</body>
</html>